﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Edu.ZJ
{
    public class FileUtil
    {
        public static string GetFilePath(params string[] list)
        {
            string path = AppDomain.CurrentDomain.BaseDirectory;
            if (list != null && list.Length > 0)
            {
                foreach (var item in list)
                {
                    path = Path.Combine(path, item);
                }
            }
            return path;
        }

        public static void WriteFileContent(string content, params string[] list)
        {
            string path = GetFilePath(list);

            File.WriteAllText(path, content, Encoding.UTF8);
        }

        public static string GetFileContent(params string[] list)
        {
            string path = GetFilePath(list);

            return File.ReadAllText(path, Encoding.UTF8);
        }
    }
}
